package com.example.rednest.controller;


import com.example.rednest.pojo.News;
import com.example.rednest.pojo.ResponseVO;
import com.example.rednest.service.NewsService;
import com.example.rednest.tool.ResultUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;
import java.util.List;

@Controller
public class NewsController {

    @Autowired
    private NewsService newsService = null;

    @RequestMapping("/news")
    @ResponseBody
    public ResponseVO selectNewsByData(int id){
        News news = newsService.selectNewsById(id);
        return ResultUnit.success("成功！",news);
    }

}
